package com.base.service.session;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.sql.Blob;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;

import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.criterion.Projections;

import tool.JsonTool;
import tool.TimeTool;

import com.base.bean.*;
import com.base.dao.*;
;

/**
 * 功能介绍：
 * 会话的创建
 * 会话消息的按不同状态的查询以及数量统计
 * 会话消息的创建以及处理
 * 会话消息的回复
 * 会话关联对象的创建以及状态修改
 * @author chz
 *
 */
public class SessionDaoInstance {

	// 单例模式 start
	private volatile static SessionDaoInstance instance = null;
	private final int expireDays = 2; // session默认有效天数

	private SessionBaseDao baseDao;
	private SessionObjDao objDao;
	private SessionUsrMsgDao msgDao;
	private SessionUsrReplyDao replyDao;
	private SessionTypeDao typeDao;

	private SessionDaoInstance() {
		baseDao = (SessionBaseDao) _BaseDao.ac.getBean("SessionBaseDao");
		replyDao = (SessionUsrReplyDao) _BaseDao.ac.getBean("SessionUsrReplyDao");
		msgDao = (SessionUsrMsgDao) _BaseDao.ac.getBean("SessionUsrMsgDao");
		objDao = (SessionObjDao) _BaseDao.ac.getBean("SessionObjDao");
		typeDao = (SessionTypeDao) _BaseDao.ac.getBean("SessionTypeDao");
	}

	public static SessionDaoInstance getInstance() {
		if (instance == null) {
			synchronized (SessionDaoInstance.class) {// 1
				if (instance == null) {// 2
					instance = new SessionDaoInstance();// 3
				}
			}
		}
		return instance;
	}

	// 单例模式 end
	
	// 获取首页消息提示：
	

	

	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {

	}

	public SessionBaseDao getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(SessionBaseDao baseDao) {
		this.baseDao = baseDao;
	}

	public SessionObjDao getObjDao() {
		return objDao;
	}

	public void setObjDao(SessionObjDao objDao) {
		this.objDao = objDao;
	}

	public SessionUsrMsgDao getMsgDao() {
		return msgDao;
	}

	public void setMsgDao(SessionUsrMsgDao msgDao) {
		this.msgDao = msgDao;
	}

	public SessionUsrReplyDao getReplyDao() {
		return replyDao;
	}

	public void setReplyDao(SessionUsrReplyDao replyDao) {
		this.replyDao = replyDao;
	}

	public SessionTypeDao getTypeDao() {
		return typeDao;
	}

	public void setTypeDao(SessionTypeDao typeDao) {
		this.typeDao = typeDao;
	}

}
